package com.lagou.exam;

import java.util.Random;

public class ServerRandom {

    private static Random rd = new Random();

    /**
     * 自定义成员方法实现随机数的获取, 用于试题id
     * @return
     */
    public static int getRandomId() {
        return rd.nextInt(20000);
    }

    public static int getRandomScore() {
        return rd.nextInt(4)+2 ; // 2-5分
    }

    public static void main(String[] args) {

        System.out.println(ServerRandom.getRandomId());
        System.out.println(ServerRandom.getRandomScore());
    }
}

